<!DOCTYPE html>
<html lang="en"xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>类别增加</title>
    <link rel="stylesheet" th:href="@{/css/pintuer.css}">
    <link rel="stylesheet" th:href="@{/css/admin.css}">
    <script type="application/javascript" th:src="@{/js/jquery-3.5.1.js}"></script>
    <script>
        $(document).ready(function () {
            $("#myForm").submit(function () {
               var name= $("#name").val();
               if (name==''){
                   $("#msg").html("不能为空！")
                   return false
               }else {
                   if (name.length>5){
                       $("#msg").html("必须为1-5个字符串！")
                       return false
                   }
                   return true
               }
            })
        })
    </script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head" id="add">
        <strong><span class="icon-pencil-square-o"></span>增加视频类别</strong>
    </div>
    <div class="body-content">
        <form id="myForm" method="post" class="form-x" action="/category/updateOrAdd">
            <div class="form-group">
                <div class="label">
                    <label>类别名称：</label>
                </div>
                <div class="field">
                    <input style="display: none" name="id" th:value="${category}==null?'':${category.id}">
                    <input  type="text" id="name" class="input w50" th:value="${category}==null?'':${category.name}"  name="name" />
                    <div class="tips" style="color: red" id="msg" th:text="${msg}"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label></label>
                </div>
                <div class="field">
                    <button class="button bg-main icon-check-square-o" type="submit">
                        提交</button>
                </div>
            </div>
        </form>
    </div>
</div>
</body>
</html>